<template>
  <div class="filter-container">
    <template v-for="(item, _index) in listQueryParams">
      <template v-if="item.type === 1">
        <a-input
          :key="_index"
          v-model="item.val"
          clearable
          class="filter-item"
          style="width: 200px; margin-right: 10px;"
          size="small"
          :placeholder="item.desc"
        />
      </template>
    </template>
    <a-button
      class="filter-item"
      type="primary"
      size="small"
      @click="initList(true)"
    >
      查找
    </a-button>
    <template v-if="clickAdd">
      <a-button
        class="filter-item"
        type="primary"
        size="small"
        @click="clickAdd"
      >
        添加
      </a-button>
    </template>
    <slot
      name="afterListQueryButton"
      :getList="initList"
    />
  </div>
</template>

<script setup>
defineProps({
  listQueryParams: {
    type: Array,
    default: () => []
  },
  disableFeatures: {
    type: Array,
    default: () => []
  },
  initList: {
    type: Function,
    default: () => {}
  },
  clickAdd: {
    type: Function,
    default: undefined
  }
})
</script>

<style scoped>
.filter-item {
  margin-left: 5px;
}
.filter-container {
  margin-bottom: 6px;
}
</style>